INCLUDE_DIR = ./Include
#export INCLUDE_DIR
#LIBS := libadd.a libafteradd.a 

LIBS := ./RELEASE/*.a
CC=gcc
CFLAGS = -I$(INCLUDE_DIR) -Wall -g 

SUBDIRS := ./course ./inputFile ./inputKeyBoard ./selectCourse ./stu
SOURCES := $(wildcard *.c)
CHEADERS := $(wildcard *.h)

objects := $(patsubst %.c,%.o,$(wildcard *.c))  

RM = rm -rf
target = exe
MAKE = make

all: $(target)

$(objects) : %.o: %.c
	$(CROSS_COMPILE)gcc -c $(CFLAGS) $< -o $@  

$(target): $(objects)
	for dir in $(SUBDIRS); do $(MAKE) -C $$dir all || exit 1; done
	$(CC) $(CFLAGS) $^ -o $@   $(LIBS) 

clean:
	@for dir in $(SUBDIRS); do make -C $$dir clean|| exit 1; done
	$(RM) $(objects)  $(LIBS) $(target)
.PHONY: all clean 

